import fetch from '@/utils/fetch';
import { projectConfig } from '@/utils/projectConfig'

export function login(loginName, loginPassword) {
  return fetch({
    url: projectConfig.URL_API_USER_LOGIN,
    method: 'post',
    data: {
      loginName,
      loginPassword
    }
  });
}

export function getInfo(token) {
  return fetch({
    url: projectConfig.URL_API_USER_GET_USER_INFO + '/' + token,
    method: 'get'
  });
}

export function logout(token) {
  return fetch({
    url: projectConfig.URL_API_USER_LOGOUT,
    method: 'patch',
    data: {token}
  });
}